<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新闻发布</title>
    <link rel="stylesheet" type="text/css" href="../layui-v2.9.10/layui/css/layui.css"/>
    <style>
        body {
            background-color: #f5f5f5;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
        }
        .layui-nav-child{
            color: #0C0C0C;
        }
        .layui-header {
            background-color: #303030;
            color: #fff;
            padding: 0 15px;
        }
        .layui-header .layui-logo {
            font-size: 24px;
            line-height: 60px;
            margin-right: 30px;
        }

        .layui-side, .layui-layout-admin .layui-body, .layui-footer {
            background-color: #f5f5f5;
            color: #333;
        }
        .layui-card-header {
            background-color: #303030;
            color: #fff;
        }
        .layui-card-body {
            background-color: #fff;
            color: #333;
        }
        .layui-layout-admin .layui-body {
            padding: 15px;
        }
        .layui-side {
            background-color: #333; /* 背景颜色 */
            flex-shrink: 0;
        }
        .layui-side-scroll {
            height: 100%; /* 高度设为100% */
            overflow: auto;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <a href="home.jsp" >
            <div class="layui-logo layui-hide-xs">新闻发布系统</div>
        </a>


        <!-- 头部区域 -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a >用户管理</a></li>
            <li class="layui-nav-item"><a >新闻管理</a></li>
        </ul>

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
                <a href="home.jsp">
                    <img src="../image/back-image.jpg" class="layui-nav-img"> <!-- 修改为实际用户头像链接 -->
                    <%= session.getAttribute("username") %>
                </a>
                <dl class="layui-nav-child" style="color: #0C0C0C">
                    <dd><a href="home.jsp">首页</a></dd>
                    <dd><a href="info.jsp">个人信息</a></dd>
                    <dd><a href="setting.jsp">设置</a></dd>
                    <dd><a href="../home/login-2.jsp;">退出</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a>
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>

    </div>
    <div class="layui-side">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域 -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a >用户管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="../SearchAllServlet.do;">用户查询</a></dd>

                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a >新闻管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="news_publish.jsp">新闻发布</a></dd>
                        <dd><a href="../NewsPublishServlet.do">新闻浏览</a></dd>
                    </dl>
                </li>

            </ul>
        </div>
    </div>
    <div class="layui-container">
        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div class="form-container">
                <h2 class="form-title">发布新闻</h2>
                <form class="layui-form" action="../NewsPublishServlet.do" method="post" enctype="multipart/form-data">
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">内容</label>
                        <div class="layui-input-block">
                            <textarea name="content" required lay-verify="required" placeholder="请输入内容" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片</label>
                        <div class="layui-input-block">
                            <input type="file" name="image" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="layui-footer">
        底部固定区域
    </div>
</div>

<script src="../layui-v2.9.10/layui/layui.js"></script>
<script>
    layui.use(['form'], function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg('发布成功！');
            return true;
        });
    });
</script>
</body>
</html>
